home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 34
/
034.d81
/
printer maze
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
3KB
|
115 lines
5 dim p$(78,3),d$(3),r(5),ck$(50)
10 poke53280,.:poke53281,.:print"[147]"chr$(142)" printer maze"
12 print" [153]by jerry a. sturdivant"
20 rem initialise
30 rem" [184][184][184][184][184][184][184][184][184][184][184][184]"
50 choice$(0)="pattern ":choice$(1)="mix ":r=rnd(-ti):n=1
60 d$(1)="[186][164][204][186] [204] [205][205][206][206] "
70 d$(2)=" [167] [165][205][160][205][206][160][206]"
80 d$(3)="[208][163][207][208][160][207][205][205][160][160][206][206]"
90 rem inputs
100 rem" [184][184][184][184][184][184][184][184]"
110 mix=0:ran=0:screen=0:nu=0:a=0
120 print"[154](s[154])creen, (h[154])ard copy, or (q[154])uit "
130 get a$:if(asc(a$+chr$(.))>128)thena$=chr$(asc(a$)-128)
135 if(a$<>"s")and(a$<>"h")and(a$<>"q")then130
137 ifa$="q"thengosub6000:goto120
138 if a$="h" thengosub7000:if(ab)thenab=.:goto120
140 if a$="s" then screen=1
150 print"(p[154])attern or (m[154])ix or (r[154])andom"
160 get a$:if(asc(a$+chr$(.))>128)thena$=chr$(asc(a$)-128)
165 if a$<>"p"anda$<>"m"anda$<>"r"then160
170 if a$="m" then mix=1
180 if a$="r" then ran=1:goto 240
190 print"would you like to enter a pattern"
195 print"number (y[154]/n[154])"
200 get a$:if a$<>"y"anda$<>"n"anda$<>"[217]"anda$<>"[206]"then200
210 if a$="y" ora$="[217]" then gosub 870:rem get selected number
215 print"[147]";
220 rem set output
230 rem" [184][184][184][184][184][184][184][184][184][184][184][184]"
240 across=78:vertical=(66-2)*2:device=4:a=0
250 if screen then across=39:vertical=23:device=3
260 close 1:open 1,device
270 if device=4 then close 6:open 6,4,6:print#6,chr$(18)
280 ifnu=1then510
290 if(a$="h")then 540
300 a$=""
310 rem pick 4 rnd numbers
320 rem" [184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"
330 for i=1 to 4
340 r(i)=int(rnd(0)*4)
350 ho$(i)=str$(r(i))
360 next
370 if r(1)=r(2) and r(2)=r(3) and r(3)=r(4) then 330
380 n=n+1:if n=50 then 830:rem quit
390 rem memorize the numbers
400 rem" [184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"
410 ck$(n)="":for i=1 to 4
420 ck$(n)=ck$(n)+right$(ho$(i),1)
430 next
440 rem see if used before
450 rem" [184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"
460 compare=n
470 for i=1 to n-1
480 if ck$(i)=ck$(compare) then 330
490 next
510 print"[147][129]selection number: [158]" choice$(mix) ck$(n)"[159]";
520 rem set up three lines
530 rem" [184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"
540 for row=1 to vertical/3
550 if mix then r(5)=r(4):r(4)=r(3):r(3)=r(2):r(2)=r(1):r(1)=r(5)
560 for x=1 to across/3
570 a=a+1:if a>4 then a=1
580 r=r(a)*3+1
590 if ran then r=int(rnd(0)*4)*3+1
600 for y=1 to 3
610 p$(x,y)=mid$(d$(y),r,3)
620 next y,x
630 rem print those three lines
640 rem" [184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"
650 for y=1 to 3
660 print#1
670 for x=1 to across/3
680 print#1,p$(x,y);
690 next x
700 get a$:if a$=" " then 730
710 next y
720 next row
730 if screen=0 then for i=1 to 6:print#1:next
740 rem full page-now what?
750 rem" [184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"
760 print
770 print" [154]would you like to do another? (y[154]/n[154])"
800 get a$:ifa$<>"y"anda$<>"n"anda$<>"[217]"anda$<>"[206]"then800
820 if a$="y"ora$="[217]"then10
830 close 1:if device=4 then print#6,chr$(36):close 6
840 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
842 print"[147]";:ifer<>63thenend
844 load"hello connect",8
850 rem input selected number
860 rem" [184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"
870 n=n+1:nu=1
880 print "[154]enter a four-digit number [0 - 3]"
885 print ":[164] [157][157][157][157]";:gosub5000:ck$(n)=a$
886 ok=-1:fora=1tolen(a$):ifmid$(a$,a,1)>"3"ormid$(a$,a,1)<"0"thenok=.
887 next:ifnot(ok)thenprint"[145][145][145]";:goto880
890 for i= 1 to 4
900 r(i)=val(mid$(ck$(n),i,1))
910 next
920 return
5000 fora=1to4:g$(a)=""
5010 geta$:ifa$=""then5010
5020 if(a$=chr$(20))and(a>1)thena=a-1:print"[157][157] [157][157][164]";:g$(a)="":goto5010
5040 if(a$<"0")or(a$>"9")then5010
5050 print"[157]"a$"[164]";:g$(a)=a$:next
5060 print"[157] ":a$=""
5070 forb=1toa-1:a$=a$+g$(b):next:return
6000 print"[145] are you sure you want to quit? (y[154]/n[154])"
6010 geta$:ifa$<>"y"anda$<>"[217]"anda$<>"n"anda$<>"[206]"then6010
6020 ifa$="n"ora$="[206]"thenprint"[145]";:return
6030 goto840
7000 open15,4,15:close15:if(st=.)thenreturn
7010 print"[145][150]can't use printer ... it's not on-line.[145]"
7020 fora=1to2000:next:ab=-1:return